#ifndef WINDOW_H
#define WINDOW_H

#include <QDialog>
#include <QSystemTrayIcon>
#include <QAction>
#include <QStandardItemModel>

enum msgLevel {info = 1, warning, error};

struct Msg {
    int level;
    char msg[256];
};

QT_BEGIN_NAMESPACE
namespace Ui { class window; }
QT_END_NAMESPACE

class window : public QDialog
{
    Q_OBJECT

public:
    window(QWidget *parent = nullptr);
    ~window();


    void setVisible(bool visible) override;
    void showMessage(int level, QString msg);
    void addTableItem(int level, QString sendAddr, QString msg);

protected:
    void closeEvent(QCloseEvent *event) override;

private slots:
    void doubleClickShowWindow(QSystemTrayIcon::ActivationReason activationReason);

private:
    void createIconGroupBox();
    void createMessageGroupBox();
    void createActions();
    void createTrayIcon();

private:
    Ui::window *ui;

    QAction *restoreAction;
    QAction *quitAction;

    QSystemTrayIcon *trayIcon;
    QMenu *trayIconMenu;

    QStandardItemModel *model;
};
#endif // WINDOW_H
